package principles.P04_里氏替换原则_LiskovSubstitution;

public class P01_Improve {
    public static void main(String[] args) {
        A1 a = new A1();
        System.out.println("11-3=" + a.func1(11, 3));
        System.out.println("1-8=" + a.func1(1, 8));

        System.out.println("	");
        B1 b = new B1();
        System.out.println("11-3=" + b.func1(11, 3));
        System.out.println("1-8=" + b.func1(1, 8));
        System.out.println("11+3+9=" + b.func2(11, 3));
    }
}

class Base {

}
class A1 extends Base {
    public int func1(int num1, int num2) {
        return num1 - num2;
    }
}

class B1 extends Base {
    private A1 a1 = new A1();
    public int func1(int a, int b) {
        return a + b;
    }

    public int func2(int a, int b) {
        return func1(a, b) + 9;
    }

    public int func3(int a, int b) {
        return a1.func1(a, b);
    }
}
